﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Text;
using Think.Lenovo.Com.DataAccess;
using System.Data;

using Think.Lenovo.Com.Models;
using Think.Lenovo.Com.Models.Material;

namespace Think.Lenovo.Com.home.ajax
{
    /// <summary>
    /// product 的摘要说明
    /// </summary>
    public class product : IHttpHandler
    {
        productClassInfo classInfo = new productClassInfo();

        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            String doing = context.Request["doing"];
            switch (doing)
            {
                case "1":
                    //do something...
                    GetChildClass(context);
                    break;
            }

        }
        public void GetChildClass(HttpContext hc)
        {
            hc.Response.ContentEncoding = System.Text.Encoding.UTF8;
            hc.Response.ContentType = "text/plain";
            StringBuilder str = new StringBuilder();
            str.Append(hc.Request["parentId"]);
      
            List<ProductClassModel> list= classInfo.GetSubClassList(str);
            System.Web.Script.Serialization.JavaScriptSerializer serializer = new System.Web.Script.Serialization.JavaScriptSerializer();
            String json = serializer.Serialize(list);
            //string xml = ds.GetXml();
            hc.Response.Write(json);
        }
        public bool IsReusable
        {
            get
            {
                return false;
            }
        }
    }
}